#! /usr/bin/env bash

file=$1

if [ -z "$file" ]
then
	echo Usage: $(basename $0) file
	exit
fi

if [ -f "$file" ]
then
	while read process
	do
		children=$(ps -o pid --no-headers --ppid=$process)
		kill -9 $process 2> /dev/null
		for child in $children
		do
			kill -9 $child 2> /dev/null
		done
	done < "$file"

	rm "$file"
fi

